const express = require('express');
const router = express.Router();
const diaryController = require('../controllers/diaryController');
const authenticate = require('../middleware/auth');

// 创建日记 (需要认证)
router.post('/', authenticate, diaryController.createDiary);

// 获取日记
router.get('/:id', diaryController.getDiary);

// 获取用户的所有日记 (需要认证)
router.get('/user/:userId', authenticate, diaryController.getUserDiaries);

// 更新日记 (需要认证)
router.put('/:id', authenticate, diaryController.updateDiary);

// 删除日记 (需要认证)
router.delete('/:id', authenticate, diaryController.deleteDiary);

module.exports = router;